<!DOCTYPE html>
<html lang="en">
<head>
  <title><%= show_title (@title) %></title>
  <%= stylesheet_link_tag :all, :cache => true %>
  <%= javascript_include_tag "jquery.min.js", "../bootstrap/js/bootstrap.js", "common.js" , :cache => true %>
  <%= stylesheet_link_tag "../bootstrap/css/bootstrap.css" %>
  <%= csrf_meta_tag %>
  <meta name="description" content="Xem online và tải/download anime tiếng Việt, anime vietsub, xem anime online, xem anime online, download anime, anime online" />

  <script type='text/javascript' src='http://localhost:3000/js/soCore.js'></script>

</head>
<body>
    <div class="container-fluid">
    	<div class="row-fluid" style="position:fixed;left:0px;">
    		<div class="span12">
	    		<%= render "home/header" %>
	    	</div>
	    </div>
    	<div class="row-fluid" style="height:60px;">&nbsp;</div>
	    <div class="row-fluid" style="min-height:400px;">
		    <div class="span3 well">
		   		 <%= render "home/sidebar" %>
		    </div>
		    <div class="span9">
		    	<%= yield %>
		    </div>
	    </div>

	    <div class="row-fluid">
    		<div class="span12">
	    		<%= render "home/footer" %>
	    	</div>
	    </div>
    </div>

    <div class="modal hide fade" id="edit_post" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="margin-top:-120px;">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
			<h3 id="myModalLabel">Edit Your Post</h3>
		</div>
		<div class="modal-body">
			<input type="hidden" id="post_id" value="" />
			<textarea rows="3" maxlength="250" id="content_post" style="width:97%"></textarea>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
			<button class="btn btn-primary" onclick="edit_post()";>Save changes</button>
		</div>
	</div>
	<script type="text/javascript">
		function show_edit_post(id){
			$.post('<%= edit_post_path %>', { "id": id },
			 function(data){
			 	$('#content_post').val(data.post.content);
			 	$('#post_id').val(id);
			  	$('#edit_post').modal();
			 }, "json");
		}

		function edit_post(){
			if($.trim($('#content_post').val())!=""){
				$.post('<%= edit_post_path %>', { "id": $('#post_id').val(),"content": $('#content_post').val() },
				 function(data){
				 	html = ""
				 	$('#content_'+$('#post_id').val()).html(data.post.content);
				 	$('#date_'+$('#post_id').val()).html("&nbsp;&nbsp;&nbsp;(Edit At : Recently) ");
				  	$('#edit_post').modal('hide');
				 }, "json");
			}
		}
	</script>
</body>
</html>
